home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n06.arc / MACDOC.WWD < prev    next >
Text File  |  1991-03-06  |  4KB  |  111 lines

  1. «MDNM»Sub MAIN
  2. REM -- This macro retrieves all global macros, all macros
  3. REM -- in the current template, or both, enters them in 
  4. REM -- a document, and formats them in preparation for
  5. REM -- printing.
  6. REM -- Must start with only one Word document open
  7. REM -- using the template with the macros you want to print, 
  8. REM -- First define a dialog box to ask whether to print 
  9. REM -- template macros, global macros, or both
  10. Begin Dialog UserDialog 284, 134
  11.         Text 10, 8, 175, 13, "Copy macros for Printing"
  12.         CheckBox 30, 30, 200, 15, "&Template macros", .TP
  13.         CheckBox 30, 53, 160, 15, "&Global macros", .GBL
  14.         OKButton 184, 77, 88, 21
  15.         CancelButton 184, 101, 88, 21
  16. End Dialog
  17. Dim Dlg As UserDialog
  18. REM -- Set default to print template macros only
  19. dlg.TP = 1
  20. dlg.GBL = 0
  21. GetCurValues Dlg
  22. On Error Goto Bailout
  23. REM -- Call up the dialog box defined above.
  24. Dialog Dlg
  25. On Error Goto 0
  26. REM -- Test responses to the dialog box choices.
  27. If dlg.TP = 1 And dlg.GBL <> 1 Then
  28.         Goto GetMacros1
  29. ElseIf dlg.TP <> 1 And dlg.GBL = 1 Then
  30.         Goto GetMacros0
  31. ElseIf dlg.TP = 0 And dlg.GBL = 0 Then
  32.         Goto Bailout
  33. End If
  34. REM -- If dialog box was set to print both template and global
  35. REM -- macros, continue here.  Begin loop to print template
  36. REM -- macros first, global macros second 
  37. For Cntxt = 1 To 0 Step - 1
  38. Goto Doit
  39. REM -- If dialog box was set to print template macros only, 
  40. REM -- continue here.  Set the variable Cntxt to print 
  41. REM -- template macros only.
  42. GetMacros1: Let Cntxt = 1
  43. Goto Doit
  44. REM -- If dialog box was set to print global macros only, 
  45. REM -- continue here.  Set the variable Cntxt to print 
  46. REM -- global macros only.
  47. GetMacros0: Let Cntxt = 0
  48. REM -- Now let's get the macros, and copy them to the document
  49. Doit:   Dim DialogRecord As MacroEdit
  50.         For MacroToGet = 1 To CountMacros(Cntxt)
  51.                 GetCurValues DialogRecord
  52. REM -- test to see if the current macro is this 
  53. REM -- (self-referential) macro if not, continue.
  54.                 If MacroName$(MacroToGet, Cntxt) <> "MacroPrintAll" Then
  55.                         MacroEdit .Name = MacroName$(MacroToGet, Cntxt),
  56. .Context = Cntxt
  57.                         EditSelectAll
  58.                         EditCopy
  59.                         DocClose(2)
  60.                         Insert
  61. "*******************************************************"
  62.                         InsertPara
  63.                         Insert  MacroName$(MacroToGet, Cntxt)
  64.                         If Cntxt = 1 Then
  65.                                 Insert "   (Template Macro)"
  66.                         Else
  67.                                 Insert "   (Global Macro)"
  68.                         End If
  69.                         InsertPara
  70.                         Insert
  71. "******************************************************  "
  72.                         ChangeFontAndBold
  73.                         EditPaste
  74.                         InsertPara
  75. REM -- If the current macro is this (self-referential) macro,
  76. REM -- do not try copying it from the macro window to 
  77. REM -- the document window.  Instead, insert this message:
  78.                 Else
  79.                         Insert
  80. "*******************************************************"
  81.                         InsertPara
  82.                         Insert "MacroPrintAll Skipped.  "
  83.                         InsertPara
  84.                         Insert
  85. "*******************************************************"
  86.                         ChangeFontAndBold
  87.                 End If
  88.         Next MacroToGet
  89. If dlg.TP = 0 Or dlg.GBL = 0 Then
  90.         Goto Bailout
  91. End If
  92. Next Cntxt
  93. Bailout: End Sub
  94.  
  95. Sub ChangeFontAndBold
  96. REM -- This subroutine formats the text after copying
  97. REM -- it to the document window
  98.         InsertPara
  99.         CharLeft 1
  100.         StartOfLine 1
  101.         LineUp 2, 1
  102.         FormatCharacter .Font = "Tms Rmn", .Points = "12", .Color = 0, .Bold =
  103. 1, .Italic = 0, \
  104.         .SmallCaps = 0, .Hidden = 0, .Underline = 0, .WordUnderline = 0, \
  105.         .DoubleUnderline = 0, .Position = "0pt", .Spacing = "0pt"
  106.         CharRight 2
  107.         InsertPara
  108.         InsertPara
  109. End Sub
  110.  
  111.